﻿using Domain.Model;
using Domain.Types;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace Domain.VO
{
    [Owned]
    public class TaskSrcDataVO
    {
        public int TaskID { get; set; }
        /// <summary>
        /// 字段数据
        /// </summary>
        [StringLength(2000)]
        public string FieldData { get; set; }
        /// <summary>
        /// 任务步骤数据
        /// </summary>
        [StringLength(2000)]
        public string StepFieldData { get; set; }
        /// <summary>
        /// 提交表单名称
        /// </summary>
        [StringLength(50)]
        public string SubFieldName { get; set; }
        public LimitTimeEnum TakeLimitTime { get; set; }
        public LimitAuditEnum TakeLimitAudit { get; set; }

        public int Price { get; set; }

        internal static TaskSrcDataVO Create(TaskAggregate task)
        {
            TaskSrcDataVO taskSrcDataVO = new TaskSrcDataVO();

            taskSrcDataVO.FieldData = task.FieldData;
            taskSrcDataVO.Price = task.Price;
            taskSrcDataVO.StepFieldData = task.StepFieldData;
            taskSrcDataVO.SubFieldName = task.SubFieldName;
            taskSrcDataVO.TakeLimitAudit = task.LimitAudit;
            taskSrcDataVO.TakeLimitTime = task.LimitTime;
            taskSrcDataVO.TaskID = task.ID;

            return taskSrcDataVO;
        }
    }
}
